home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 March / EnigmA AMIGA RUN 05 (1996)(G.R. Edizioni)(IT)[!][issue 1996-03][Skylink CD IV].iso / earcd / hardware / pckybhck.lha / pckeybhack / onlyAT.asm next >
Assembly Source File  |  1996-02-12  |  25KB  |  790 lines

  1. ;* these port equates are explained below. Relocate them to any of
  2. ;* Port1, pins 0-7 or Port3, pins 0-7, except Port3, pins2 and 3
  3. ;* because these are the external interrupts.
  4. ;* it doesn't matter as long as you equate the right pin to the right
  5. ;* signal.
  6.  
  7.         .equ    Kclk,p1.0
  8.         .equ    Kdat,p1.1
  9.         .equ    Aclk,p1.3
  10.         .equ    Adat,p1.4
  11.         .equ    Areset,p1.5
  12.  
  13.         .org    0000h
  14.  
  15. init:   ljmp    start
  16.         .org    001bh
  17.         ljmp    timer1int
  18.  
  19. ;**************************************************
  20. ;*
  21. ;*
  22. ;* Equates Descriptions:
  23. ;* 
  24. ;*      Aclk is the line to the Amiga keyboard clock in. (P1.3)
  25. ;*      Adat is the line to the Amiga keyboard data in. (P1.4)
  26. ;*      Areset is the Amiga Reset line (P1.5) (for the A500)
  27. ;*      Kclk is the line to the Keyboard clock out (P1.0)
  28. ;*      Kdat is the line to the Keyboard data out (P1.1)
  29. ;*
  30. ;*      Oldchar is the last character typed to go to the Amiga.
  31. ;* This is used to tell if the Capslock was Pressed and 
  32. ;* Released without pressing any other keys. If this was done, 
  33. ;* then it is a "Caps Lock" otherwise, the Caps key functions
  34. ;* as the Control Key because of the keyboard remapping.
  35. ;*
  36. ;*      Capbit is the flag which tells whether the Caps Lock
  37. ;* should be down or up.
  38. ;*      Capdown is the flag which tells whether the Caps Lock 
  39. ;* KEY is presently down or up. The difference between Capdown 
  40. ;* and Capbit is that Capdown relates to the KEY. Capbit toggles 
  41. ;* once for every "press and release" of the Cap Lock Key. 
  42. ;* Press and release Cap Lock Key, and Capbit goes low.....
  43. ;* Press and release it again, and Capbit goes high....
  44. ;*      Cntldown is the flag which is set and reset when you 
  45. ;* press Cap Lock and then another key. Then, Cap Lock Key 
  46. ;* functions as the Control Key.
  47. ;* LAMIGA,RAMIGA,and CONTROL are all flags that tell if those 
  48. ;* keys are being held down. When all three are, the computer
  49. ;* will reset.
  50. ;*
  51. ;* ATparity is the 10th bit that the AT keyboard transmits. It 
  52. ;* is SET if the number of DATA bits set is EVEN. Otherwise, its
  53. ;* CLEARED.
  54. ;*
  55. ;**************************************************
  56.  
  57.         ;bit memory locations:
  58.  
  59.         .equ    Capbit,42h
  60.         .equ    Capdown,43h
  61.         .equ    Ctrldown,44h
  62.         .equ    CONTROL,45h
  63.         .equ    LAMIGA,46h
  64.         .equ    RAMIGA,47h
  65.         .equ    ATparity,48h
  66.         .equ    Make,49h
  67.  
  68.         ;byte memory locations:
  69.  
  70.         .equ    Charbad,50h
  71.         .equ    Oldchar,51h
  72.         .equ    Amigachar,52h
  73.  
  74.         .org    0200h
  75.  
  76. start:  mov     tmod,#11h       ;two 16 bit timers
  77.         mov     tcon,#05h        ;edge triggered interrupt.
  78.         mov     ie,#00h         ;clear all interrupts
  79.         setb    ea
  80.         setb    et1             ;enable timer 1
  81.         setb    pt0                ;timer 0 has high priority
  82.         mov     sp,#30h         ;stack somewhere safe.
  83.  
  84. ; set the ports for input
  85.         mov     p1,#255         ;set port1 for read
  86.         clr     tr1             ;make sure timers are in
  87.         clr     tf1             ;reset state.
  88.         clr     tr0
  89.         clr     tf0
  90.  
  91. ; clear out the miscellaneous flags.
  92.         clr     Capdown         ;Caps is up...
  93.         clr     Ctrldown        ;Control is up
  94.         clr     Capbit          ;Caps light is off.
  95.         setb    CONTROL         ;all reset keys are UP
  96.         setb    LAMIGA
  97.         setb    RAMIGA
  98.  
  99. ;**** sync the controller with the Amiga. clock out
  100. ;**** ones until we receive a handshake...
  101. sync:
  102.         mov     tl1,#0          ;set up timer for 143ms
  103.         mov     th1,#0
  104.         mov     r1,#2
  105.         setb     tr1
  106. sync2:
  107.         jb      Adat,sync2      ;wait for handshake
  108. sync3:
  109.         jnb     Adat,sync3      ;wait for end of handshake
  110.         clr     tr1
  111.  
  112. ;**** transmit power up key stream and end key stream.
  113.         mov     a,#0FDh
  114.         acall   actualtransmit
  115.         mov     a,#0FEh
  116.         acall   actualtransmit
  117.  
  118. ;**** sync up the AT and go with it!
  119.  
  120. ATPowerup:
  121.         mov     a,#0ffh         ;RESET
  122.         acall   SendtoAT
  123.         mov     a,#0f6h         ;DEFAULT
  124.         acall   SendtoAT
  125.         mov     a,#0edh         ;NEXT DATA is FOR LIGHTS
  126.         acall   SendtoAT
  127.         mov     a,#2            ;NUMLOCK ON?
  128.         acall   SendtoAT
  129.         mov     a,#0f4h         ;CLEAR BUFFER
  130.         acall   SendtoAT
  131.  
  132.         ljmp    ATstyle         ;go and parse AT keyboard
  133.  
  134. ;***********************************************
  135. ;* ATgetkey
  136. ;* ATgetkey
  137. ;* ATgetkey
  138. ;*
  139. ;* ATgetkey looks at the keyboard and waits for a key to be
  140. ;* pressed. ATinkey is the actual routine that watched the logic
  141. ;* levels of Kdat and Kclk. IF the character's parity is not 
  142. ;* what it is supposed to be, then the routine will attempt to
  143. ;* tell the keyboard to resend.
  144. ;*
  145. ;* When exiting from this routine, Kclock is pulled low to hold 
  146. ;* off any more transmissions. You must restore it to 5 volts to
  147. ;* receive any more characters later.
  148. ;*
  149. ;*
  150.  
  151. ATgetkey:
  152.         mov     r0,#11          ;number of bits
  153.         setb    Kclk
  154. ATwaitC0:         
  155.         jb      Kclk,ATwaitC0   ;wait for a clock pulse
  156.         dec     r0              ;decrement clock bit counter
  157.         cjne    r0,#10,ATnstart ;test for startbit
  158.         sjmp    ATwait  
  159. ATnstart:
  160.         cjne    r0,#0,ATnstop   ;check for stopbit      
  161. ATwaitC1:
  162.         jnb     Kclk,ATwaitC1   ;wait for clock to go high                     
  163.         clr     Kclk            ;hold off more data
  164.         mov     r0,#20          ;small delay
  165. pause:  djnz    r0,pause
  166. ;**** now we check to see if the parity between
  167. ;**** Bit register P (which is set if Parity of Acc is odd)
  168. ;**** is compared to the received Parity Bit.
  169.         jb      p,parityodd     ;test if parity of DATA is odd
  170. parityeven:
  171.         jnb     ATparity,ATerror
  172.         ret                     ;Okay to return. A=valid
  173. parityodd:
  174.         jb      ATparity,ATerror
  175.         ret                     ;Okay to return. A=valid
  176. ATerror:
  177.         mov     a,#0feh         ;RESEND character
  178.         acall   SendtoAT
  179.         sjmp    ATgetkey        ;now return to caller
  180. ATnstop:
  181.         cjne    r0,#1,ATdatab   ;check for paritybit
  182.         mov     c,Kdat          ;error checking! (AT only)
  183.         mov     ATparity,c
  184.         sjmp    ATwait          ;
  185. ATdatab: 
  186.         mov     c,Kdat          ;get data bit
  187.         rrc     a               ;shift it into accumulator
  188. ATwait: jnb     Kclk,ATwait     ;wait for clock line to go low
  189.         sjmp    ATwaitC0        ;get another bit
  190.  
  191.  
  192. ;**************************************************
  193. ;* AT-STYLE
  194. ;*
  195. ;*     This waits for a keycode or two from the IBM and then calls
  196. ;* the appropriate transmit subroutine. The IBM keyboard sends 
  197. ;* out special codes in front of and behind some scancodes. This
  198. ;* routine will chop them out before doing a lookup on the 
  199. ;* code to see what to send to the AMIGA. The scancodes between 
  200. ;* the IBM and the AMIGA are of course, not the same!
  201. ;*
  202. ;**************************************************
  203.  
  204. ATstyle:
  205.         acall   ATgetkey          ;get one scancode.
  206.         cjne    a,#0e1h,ATnE1
  207.         acall   ATgetkey          ;(should be 14)
  208.         acall   ATgetkey          ;(should be 77)
  209.         acall   ATgetkey          ;(should be E1)
  210.         acall   ATgetkey          ;(should be F0)
  211.         acall   ATgetkey          ;(should be 14)
  212.         acall   ATgetkey          ;(should be F0)
  213.         acall   ATgetkey          ;(should be 77)
  214.         sjmp    ATstyle
  215. ;PAUSE was pressed. Just ignore it.
  216. ATnE1:
  217.         mov     dptr,#ATtb1
  218.         cjne    a,#0e0h,ATnE0
  219.         mov     dptr,#ATtb2
  220.         acall   ATgetkey
  221.         cjne    a,#0f0h,ATnE0F0
  222.         acall   ATgetkey
  223.         cjne    a,#12h,ATnEF12
  224.         ljmp    ATstyle         ;(E0F012....ignore it)
  225. ATnEF12:
  226.         cjne    a,#59h,ATup     ;(E0F0mk)
  227.         ljmp    ATstyle         ;(E0F059....ignore it)
  228. ATnE0F0:
  229.         cjne    a,#12h,ATnE012
  230.         ljmp    ATstyle         ;(E012....ignore it)
  231. ATnE012:
  232.         cjne    a,#59h,ATdown   ;(E0mk)
  233.         ljmp    ATstyle         ;(E059....ignore it)
  234. ATnE0:
  235.         cjne    a,#0f0h,ATdown  ;(mk)
  236.         acall   ATgetkey
  237.         sjmp    ATup            ;(F0mk....normal key break)
  238.  
  239. ;**************************************************
  240. ;* ATdown and the rest here call a lookup table to change
  241. ;* the AT scancodes into AMIGA scancodes. In the "down"
  242. ;* routine, the "make" bit is asserted. In the "up" routine
  243. ;* it is de-asserted.
  244. ;**************************************************
  245. ATdown:
  246.         movc    a,@a+dptr       ;indexed into table
  247.         clr     acc.7           ;clear make/break bit
  248.         acall   transmit        ;transmit it
  249.         ljmp    ATstyle
  250. ATup:
  251.         movc    a,@a+dptr
  252.         setb    acc.7           ;set make/break bit
  253.         acall   transmit        ;transmit it
  254.         ljmp    ATstyle
  255.  
  256. ;**************************************************
  257. ;* SendtoAT is the subroutine that sends special codes
  258. ;* to the keyboard from the controller. Codes include
  259. ;* the command to reset (FF) or the command to change
  260. ;* the lights (ED). It is advisable to keep the timing
  261. ;* very close to how I have it done in this routine.
  262. ;**************************************************
  263.  
  264. SendtoAT:
  265.         setb    Kclk
  266.         clr     Kdat
  267.         mov     r0,#8
  268. Send4:  jb      Kclk,Send4      ;data bit
  269.         mov     c,acc.0
  270.         mov     Kdat,c
  271.         rr      a 
  272. Send5:  jnb     Kclk,Send5      ;data bit
  273.         dec     r0
  274.         cjne    r0,#0,Send4
  275.         mov     c,p
  276.         cpl     c
  277. Send6:  jb      Kclk,Send6      ;parity bit
  278.         mov     Kdat,c
  279. Send7:  jnb     Kclk,Send7      ;parity bit
  280. Send77: jb      Kclk,Send77     ;stop bit
  281.         setb    Kdat
  282. Send78: jnb     Kclk,Send78     ;stop bit
  283. Send79: jb      Kclk,Send79
  284. Send7a: jnb     Kclk,Send7a
  285.         mov     r0,#8           ;small delay
  286. Send8:  djnz    r0,Send8
  287.         clr     Kclk            ;drive clock low
  288.         mov     r0,#20          ;long delay
  289. Send9:  djnz    r0,Send9
  290.         setb    Kclk
  291.         acall   ATgetkey        ;should check if response isbad.
  292.         ret                     ;who cares if it is? not me!
  293.  
  294. ;**************************************************
  295. ;*
  296. ;* TRANSMIT first does some checking to take out repeating
  297. ;* keys and does the conversion on the Caps Lock Key and
  298. ;* then calls Actualtransmit.
  299. ;*
  300. ;**************************************************
  301.  
  302. dontrans:                       ;jumps back if key is already
  303.         pop     acc             ;held down.
  304.         ret
  305. transmit:
  306.         cjne    a,Oldchar,transok
  307.         ret
  308. transok:
  309.         cjne    a,#62h,transok2 ;jump if not CapsLock=down
  310.         mov     Oldchar,a
  311.         setb    Capdown         ;set the flags for later
  312.         ret
  313. transok2:                       
  314.         cjne    a,#0e2h,transok3;jump if not CapsLock=up
  315.         mov     a,Oldchar       ;see if Caps was just down
  316.         cjne    a,#62h,transok4 ;if not, then it was a control
  317. XTcap:
  318.         clr     Capdown         ;clear flag
  319.         cpl     Capbit          ;toggle down/up-ness of Caplock
  320.         mov     a,#62h
  321.         mov     c,Capbit
  322.         cpl     c
  323.         mov     acc.7,c
  324.         acall   actualtransmit  ;(Caps to Amiga!)
  325.         mov     a,#0edh         ;set lights on next byte.
  326.         acall   SendtoAT
  327.         mov     a,#2            ;numlock on
  328.         mov     c,Capbit
  329.         mov     acc.2,c
  330.         acall   SendtoAT        ;maybe capslock light
  331. skiplights: 
  332.         ret           
  333. transok4:
  334.         clr     CtrlDown        ;This sends out a Control Up.
  335.         clr     Capdown         ;Caps lock is done functioning as Ctl
  336.         mov     a,#63h          ;Control Key
  337.         setb    acc.7           ;break bit set.
  338.         acall   actualtransmit  ;send to Amiga.
  339.         ret
  340. transok3:
  341.         mov     Oldchar,a
  342.         jnb     Capdown,noControl
  343.         jb      CtrlDown,noControl
  344.         setb    CtrlDown        ;Caps lock is beginning to function
  345.         mov     a,#63h          ;as the Control Key.
  346.         acall   actualtransmit  ;send Control Down to Amiga
  347.         mov     a,Oldchar       ;now send the actual key
  348.  
  349. noControl:                      ;its not a controlled key
  350.         mov     c,acc.7         ;c=make/break bit
  351.         mov     Make,c          ;will be set if key up
  352.         clr     acc.7           ;test for key only. NO make/break
  353.         cjne    a,#0eh,noMup    ;special key mouse up
  354.         jnb     Make,kmupdown
  355. kmupup:
  356.         mov     a,#0cch         ;cursor up break
  357.         acall   actualtransmit
  358.         acall   Smalldelay
  359.         mov     a,#0e7h         ;right amiga break
  360.         acall   actualtransmit
  361.         ret
  362. kmupdown:
  363.         mov     a,#67h          ;amiga make
  364.         acall   actualtransmit
  365.         acall   Smalldelay
  366.         mov     a,#4ch          ;cursor up make
  367.         acall   actualtransmit
  368.         ret
  369. noMup:
  370.         cjne    a,#1ch,noMdown  ;special key mouse down
  371.         jnb     Make,kmdowndown
  372. kmdownup:
  373.         mov     a,#0cdh         ;cursor down break
  374.         acall   actualtransmit
  375.         mov     a,#0e7h         ;amiga break
  376.         acall   Smalldelay
  377.         acall   actualtransmit
  378.         ret
  379. kmdowndown:
  380.         mov     a,#67h          ;amiga make
  381.         acall   actualtransmit
  382.         acall   Smalldelay      ;cursor down make
  383.         mov     a,#4dh
  384.         acall   actualtransmit
  385.         ret
  386. noMdown:
  387.         cjne    a,#2ch,noMleft  ;special key mouse left
  388.         jnb     Make,kmleftdown
  389. kmleftup:
  390.         mov     a,#0cfh         ;cursor left break
  391.         acall   actualtransmit
  392.         acall   Smalldelay      ;amiga break
  393.         mov     a,#0e7h
  394.         acall   actualtransmit
  395.         ret
  396. kmleftdown:
  397.         mov     a,#67h          ;amiga make
  398.         acall   actualtransmit
  399.         acall   Smalldelay
  400.         mov     a,#4fh          ;cursor left make
  401.         acall   actualtransmit
  402.         ret
  403. noMleft:                        ;special key mouse right
  404.         cjne    a,#47h,notspecial
  405.         jnb     Make,kmrhtdown
  406. kmrhtup:
  407.         mov     a,#0ceh         ;cursor right break
  408.         acall   actualtransmit
  409.         acall   Smalldelay
  410.         mov     a,#0e7h         ;amiga break
  411.         acall   actualtransmit
  412.         ret
  413. kmrhtdown:
  414.         mov     a,#67h          ;amiga make
  415.         acall   actualtransmit
  416.         acall   Smalldelay
  417.         mov     a,#04eh         ;cursor right make
  418.         acall   actualtransmit
  419.         ret
  420. Smalldelay:
  421.         mov     th0,#0
  422.         mov     tl0,#0
  423.         clr     tf0
  424.         setb    tr0
  425. small1: jnb     tf0,small1
  426.         clr     tf0
  427.         clr     tr0
  428.         ret
  429. notspecial:
  430.         mov     a,Oldchar
  431.         acall   actualtransmit  ;transmit the keycode
  432.         mov     a,Oldchar       ;get back same keycode, in A.
  433.         mov     c,acc.7         ;put make/break bit in Make
  434.         mov     Make,c
  435.         clr     acc.7           ;start testing for reset keys
  436.         cjne    a,#63h,nrset1   ;held down
  437.         mov     c,Make
  438.         mov     CONTROL,c
  439.         sjmp    trset
  440. nrset1: cjne    a,#66h,nrset2
  441.         mov     c,Make
  442.         mov     LAMIGA,c
  443.         sjmp    trset
  444. nrset2: cjne    a,#67h,trset
  445.         mov     c,Make
  446.         mov     RAMIGA,c
  447. trset:  jnb     CONTROL,maybefree       ;if bit set, this key is up
  448.         jb      CtrlDown,maybefree      ;if bit set, this key is down
  449.         sjmp    free
  450. maybefree:
  451.         jb      LAMIGA,free     ;ditto
  452.         jb      RAMIGA,free     ;ditto
  453.         sjmp    resetwarn       ;OOPS! They are all down!
  454. free:   ret
  455. resetwarn:
  456.         clr     tf0             
  457.         mov     a,78h
  458.         mov     r1,#2           ;set up timer 0 watchdog
  459.         mov     tl0,#0
  460.         mov     th0,#0
  461.         cpl     a               ;invert, don't know why.
  462.         mov     r0,#8
  463. wr1:
  464.         rl      a
  465.         mov     c,acc.7
  466.         mov     Adat,c
  467.         mov     b,#8
  468. wr2:
  469.         djnz    b,wr2             ; transmit it.
  470.         clr     Aclk
  471.         mov     b,#8
  472. wr3:
  473.         djnz    b,wr3
  474.         setb    Aclk
  475.         mov     b,#10
  476. wr4:
  477.         djnz    b,wr4
  478.         djnz    r0,wr1
  479.         setb    Adat
  480.         setb    tr0             ;start watchdog
  481. wr5:
  482.         jnb     Adat,caught1
  483.         jnb     tf0,wr5
  484.         clr     tf0
  485.         djnz    r1,wr5
  486.         sjmp    Hardreset
  487. caught1:
  488.         clr     tr0
  489.         clr     tf0
  490.         mov     a,78h
  491.         mov     r1,#4
  492.         mov     tl0,#0
  493.         mov     th0,#0
  494.         cpl     a    
  495.         mov     r0,#8
  496. wr11:
  497.         rl      a
  498.         mov     c,acc.7
  499.         mov     Adat,c
  500.         mov     b,#8
  501. wr22:
  502.         djnz    b,wr22   
  503.         clr     Aclk
  504.         mov     b,#8
  505. wr33:
  506.         djnz    b,wr33
  507.         setb    Aclk
  508.         mov     b,#10
  509. wr44:
  510.         djnz    b,wr44
  511.         djnz    r0,wr11
  512.         setb    Adat
  513.         setb    tr0             ;start watchdog
  514. wr55:
  515.         jnb     Adat,caught2
  516.         jnb     tf0,wr55
  517.         clr     tf0
  518.         djnz    r1,wr55
  519.         sjmp    Hardreset
  520. caught2:
  521. hold:   jnb     Adat,hold
  522. Hardreset:
  523.         clr     tr0
  524.         clr     tf0
  525.         clr     Areset
  526.         clr     Aclk            ;clear both lines for A500/A1000
  527.         mov     r1,#15          ;clock should go low for over 500ms
  528.         mov     th0,#0          ;timer 1 will overflow repeatedly
  529.         mov     tl0,#0
  530.         setb    tr0
  531. hsloop:
  532.         jnb     tf0,hsloop      ;wait for overflow flag
  533.         clr     tf0             ;clear it again
  534.         djnz    r1,hsloop
  535.         clr     tf0
  536.         clr     tr0             ;stop the timer
  537.         ljmp    start
  538.  
  539. ;**************************************************
  540. ;* 
  541. ;* ActualTransmit sends the character out to the Amiga and waits
  542. ;* for an acknowledge handshake. If it does not receive one in
  543. ;* 143 ms, then it clocks out 1's on the data line until it 
  544. ;* receives the acknowledge. If the Amiga is not connected up, 
  545. ;* then it will hang here. The handshake is that the AMIGA 
  546. ;* drives the clock line low.
  547. ;*
  548. ;*      The loops with register B are for timing delays. 
  549. ;* There should be about 20usec between when the Data line is 
  550. ;* set, the Clock line is driven low, and the Clock line
  551. ;* is driven high.
  552. ;*
  553. ;**************************************************
  554.  
  555. actualtransmit:
  556.         mov     Amigachar,a     ;set the character to transmit
  557.  
  558.         mov     r0,#05          ;do a small delay
  559. dly:
  560.         mov     b,#0
  561. delay:  djnz    b,delay
  562.         djnz    r0,dly
  563.  
  564. actual2:
  565.         mov     a,Amigachar     ;restore it
  566.         clr     Charbad         ;character is not bad yet
  567.         mov     r1,#2           ;set up timer 0 watchdog
  568.         mov     tl1,#0
  569.         mov     th1,#0
  570.         cpl     a               ;invert, don't know why.
  571.         mov     r0,#8
  572. f:      rl      a
  573.         mov     c,acc.7
  574.         mov     Adat,c
  575.         mov     b,#8
  576. g:      djnz    b,g             ; transmit it.
  577.         clr     Aclk
  578.         mov     b,#8
  579. h:      djnz    b,h
  580.         setb    Aclk
  581.         mov     b,#10
  582. i:      djnz    b,i
  583.         djnz    r0,f
  584.         setb    Adat
  585.         setb    tr1             ;start watchdog
  586. waitshake:
  587.         jb      Adat,waitshake
  588.         clr     tr1             ;stop watchdog
  589. gotit:  jnb     Adat,gotit
  590.         ret
  591.  
  592. timer1int:
  593.         djnz    r1,t3           ;we wait for 143 ms.
  594.         mov     r1,#2           
  595.         setb    Charbad         ;flag to resend the character
  596.         clr     Adat            ;1 on the data line
  597.         mov     b,#8
  598. tt1:    djnz    b,tt1           ;wait for it
  599.         clr     Aclk            ;clock asserted
  600.         mov     b,#8            ;sync up the controller to the
  601. tt2:    djnz    b,tt2           ;amiga
  602.         setb    Aclk
  603.         mov     b,#10
  604. tt3:    djnz    b,tt3
  605.         setb    Adat
  606. t3:     reti                    ;return and send again.
  607.  
  608. ATtb1: 
  609.         .db     0               
  610.         .db     58h             ;F9
  611.         .db     0               
  612.         .db     54h             ;F5
  613.         .db     52h             ;F3
  614.         .db     50h             ;F1
  615.         .db     51h             ;F2
  616.         .db     63h             ;F12=CTRL (charles)
  617.         .db     0
  618.         .db     59h             ;F10
  619.         .db     57h             ;F8
  620.         .db     55h             ;F6
  621.         .db     53h             ;F4
  622.         .db     42h             ;TAB
  623.         .db     00h             ;~
  624.         .db     0
  625.  
  626.         .db     0
  627.         .db     64h             ;Left ALT
  628.         .db     60h             ;Left SHIFT
  629.         .db     0
  630.         .db     66h             ;Left Ctrl=Left AMIGA
  631.         .db     10h             ;Q
  632.         .db     01h             ;1
  633.         .db     0
  634.         .db     0
  635.         .db     0
  636.         .db     31h             ;Z
  637.         .db     21h             ;S
  638.         .db     20h             ;A
  639.         .db     11h             ;W
  640.         .db     02h             ;2
  641.         .db     0
  642.  
  643.         .db     0
  644.         .db     33h             ;C
  645.         .db     32h             ;X
  646.         .db     22h             ;D
  647.         .db     12h             ;E
  648.         .db     04h             ;4
  649.         .db     03h             ;3
  650.         .db     0
  651.         .db     0
  652.         .db     40h             ;SPACE
  653.         .db     34h             ;V
  654.         .db     23h             ;F
  655.         .db     14h             ;T
  656.         .db     13h             ;R
  657.         .db     05h             ;5
  658.         .db     0
  659.  
  660.         .db     0
  661.         .db     36h             ;N
  662.         .db     35h             ;B
  663.         .db     25h             ;H
  664.         .db     24h             ;G
  665.         .db     15h             ;Y
  666.         .db     06h             ;6
  667.         .db     0
  668.         .db     0
  669.         .db     0
  670.         .db     37h             ;M
  671.         .db     26h             ;J
  672.         .db     16h             ;U
  673.         .db     07h             ;7
  674.         .db     08h             ;8
  675.         .db     0
  676.  
  677.         .db     0
  678.         .db     38h             ;<
  679.         .db     27h             ;K
  680.         .db     17h             ;I
  681.         .db     18h             ;O
  682.         .db     0Ah             ;0
  683.         .db     09h             ;9
  684.         .db     0
  685.         .db     0
  686.         .db     39h             ;>
  687.         .db     3ah             ;/
  688.         .db     28h             ;L
  689.         .db     29h             ; ';'
  690.         .db     19h             ;P
  691.         .db     0bh             ;-
  692.         .db     0
  693.  
  694.         .db     0
  695.         .db     0
  696.         .db     2ah             ;'
  697.         .db     0
  698.         .db     1ah             ;[
  699.         .db     0ch             ;=
  700.         .db     0
  701.         .db     0
  702.         .db     62h             ;CAPS LOCK?
  703.         .db     61h             ;Right SHIFT
  704.         .db     44h             ;RETURN
  705.         .db     1bh             ;]
  706.         .db     0
  707.         .db     2bh             ; µ ( put 2b instead d, Charles)
  708.         .db     0
  709.         .db     0
  710.         .db        0
  711.         .db        30h                ; < (add by Charles Da Costa)
  712.  
  713.         .rs     4
  714.         .db     41h             ;Back SPACE
  715.         .db     0
  716.         .db     0
  717.         .db     1dh             ;1 keypad
  718.         .db     0
  719.         .db     2dh             ;4 keypad
  720.         .db     3dh             ;7 keypad
  721.         .db     0
  722.         .db     0
  723.         .db     0
  724.  
  725.         .db     0fh             ;0 keypad
  726.         .db     3ch             ;dot keypad
  727.         .db     1eh             ;2 keypad
  728.         .db     2eh             ;5 keypad
  729.         .db     2fh             ;6 keypad
  730.         .db     3eh             ;8 keypad
  731.         .db     45h             ;ESCAPE!
  732.         .db     5ah             ;Number Lock=( (instead 63 Charles)
  733.         .db     32h             ;F11=x (instead 5a Charles)
  734.         .db     5eh             ;+ keypad
  735.         .db     1fh             ;3 keypad
  736.         .db     4ah             ;- keypad
  737.         .db     5dh             ;* keypad
  738.         .db     3fh             ;9 keypad
  739.         .db     67h             ;scroll Lock=Right AMIGA
  740.         .db     0
  741. ATtb2:
  742.         .rs     3
  743.         .db     56h             ;F7
  744.         .db     66h             ;print screen=Left Amiga
  745.         .rs     11
  746.  
  747.         .db     0
  748.         .db     65h             ;Right ALT
  749.         .db     0
  750.         .db     0
  751.         .db     67h             ;Right CTL=RIGHT AMIGA
  752.         .rs     11
  753.  
  754.         .rs     10h
  755.         
  756.         .rs     10h
  757.  
  758.         .rs     10
  759.         .db     5ch             ;/key, supposedly
  760.         .rs     5
  761.  
  762.         .rs     10
  763.         .db     43h             ;Numeric Enter
  764.         .rs     5
  765.  
  766.         .rs     9
  767.         .db     1ch             ;End=Mouse down
  768.         .db     0
  769.         .db     4fh             ;Cursor Left
  770.         .db     0eh             ;Home=Mouse up
  771.         .db     0
  772.         .db     0
  773.         .db     63h             ;MACRO key=control
  774.  
  775.         .db     2ch             ;Insert=Mouse Left
  776.         .db     46h             ;Delete
  777.         .db     4dh             ;Cursor Down
  778.         .db     0
  779.         .db     4eh             ;Cursor Right
  780.         .db     4ch             ;Cursor Up
  781.         .rs     4
  782.         .db     5fh             ;Page Down=Help
  783.         .db     0
  784.         .db     66h             ;print screen=LEFT AMIGA
  785.         .db     47h             ;Page up=mouse right
  786.         .db     40h             ;Break=Space?
  787.         .db     0
  788.  
  789.         .end    0
  790.